﻿// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "EditorUtilityWidget.h"
#include "Editor/Blutility/Classes/EditorUtilityWidget.h"
#include "Kismet/BlueprintFunctionLibrary.h" 
#include "Dialogs/DlgPickPath.h"
#include "MyEditorUtilityWidget.generated.h"

class USkeleton;

/**
 * 
 */
UCLASS()
class  MYTOOLBOXPLUGEDITOR_API  UMyEditorUtilityWidget : public UEditorUtilityWidget
{
	GENERATED_BODY()
public:


	UPROPERTY(Editanywhere, BlueprintReadWrite, Category = "MyRetargetingButton")
		FString Prefix;

	UPROPERTY(Editanywhere, BlueprintReadWrite, Category = "MyRetargetingButton")
		FString AnimFileRoot;
	UPROPERTY(Editanywhere, BlueprintReadWrite, Category = "MyRetargetingButton")
		FString CopyFileRoot;
	
	UPROPERTY(Editanywhere, BlueprintReadWrite, Category = "MyRetargeting")
		USkeleton* source;

	UPROPERTY(Editanywhere, BlueprintReadWrite, Category = "MyRetargeting")
		USkeleton* target;



	

	UFUNCTION(BlueprintCallable)
	static void StartWidget(USkeleton* src, USkeleton* des, TArray<UAnimSequence*> sourceAsset, FString targetPrefix = FString("MyPrefix_"));

	UFUNCTION(BlueprintCallable)
		static TArray<UAnimSequence*> GetAllAssets(FString startPath);

	UFUNCTION(BlueprintCallable)
	static TArray<FString> GetAllFilesInFolder(FString Directory, FString Extension = ".uasset");

	UFUNCTION(BlueprintCallable)
	static TArray<FString> GetAllFilesInDirectory(const FString directory, const bool fullPath, const FString onlyFilesStartingWith, const FString onlyFilesWithExtension);

	UFUNCTION(BlueprintCallable)
		static void GetRetargetPaths(const FString directory, const FString rule, TArray<FString>& originResult,TArray<FString>& ruleResult);

	UFUNCTION(BlueprintCallable)
		static void BatchRegarget(USkeleton* src, USkeleton* des,const TArray<FString> originResult, const TArray<FString> ruleResult, const FString animPrefix);

	UFUNCTION(BlueprintCallable)
		void ProcessBatchRetarget();

	UFUNCTION(BlueprintCallable)
		void OpenSourceFolder();

	UFUNCTION(BlueprintCallable)
		void OpenTargetFolder();

	UFUNCTION(BlueprintImplementableEvent)
		void OnSourceRootChange(const FString& newSourceRoot);

	UFUNCTION(BlueprintImplementableEvent)
		void TargetRootChange(const FString& newSourceRoot);

	static TSharedRef<SDlgPickPath> PickContentPathDlg;
	bool showSourcePath;
	bool showCopyPath;
protected:
	virtual void NativeTick(const FGeometry& MyGeometry, float InDeltaTime) override;
};

